home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-28 | 5.2 KB | 205 lines | [TEXT/MPS ] |
- /*
- File: CheckGestalt.cp
-
- Contains: xxx put contents here xxx
-
- Written by: Jeff Brickman
-
- Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <3> 2/21/95 TMH metrowerks compatiblity changes
- <2> 10/20/94 TMH fussed with
- <1> 10/6/94 JHB first checked in
-
- To Do:
- */
-
- #ifndef __GESTALTEQU__
- #include "GestaltEqu.h"
- #endif
-
- #ifndef __OCE__
- #include "OCE.h"
- #endif
-
- #ifndef __TOOLUTILS__
- #include "ToolUtils.h"
- #endif
-
- #ifndef __Thread__
- #include "TThread.h"
- #endif
-
- #ifndef __CheckGestalt__
- #include "CheckGestalt.h"
- #endif
-
-
-
-
- // ---------------------------------------------------------
- // C S y s t e m C o n f i g u r a t i o n
- // ---------------------------------------------------------
-
- //-------------------------------------------------------------------------
- CSystemConfiguration::CSystemConfiguration( void )
- {
- fPowerTalkAvailable = false;
- fCommToolBoxAvailable = false;
- fThreadsAvailable = false;
- fAppleEventsAvailable = false;
- fGestaltAvailable = false;
- fSystem71orNewer = false;
-
- this->HasGestalt();
- }
-
-
- //-------------------------------------------------------------------------
- long CSystemConfiguration::MyMaskBit( short theBit)
- {
- return 1<<theBit;
- }
-
-
- //-------------------------------------------------------------------------
- Boolean CSystemConfiguration::HasPowerTalk( void )
- {
- long aResponse = 0;
- long aResponseMask = 0;
-
- if (fGestaltAvailable) {
-
- aResponseMask = gestaltOCETBPresent + gestaltOCETBAvailable; // Rather then which bit is the flag these are the bits
- Gestalt(gestaltOCEToolboxAttr, &aResponse);
- fPowerTalkAvailable = (aResponseMask & aResponse) == aResponseMask;
- }
-
- return fPowerTalkAvailable;
- }
-
-
- //-------------------------------------------------------------------------
- Boolean CSystemConfiguration::HasCommToolbox( void )
- {
- long aResponse = 0;
- long aResponseMask = 0;
-
- if (fGestaltAvailable) {
-
-
- // Check to see if the file transfer manager is present and if relevent attributes are present
-
-
- aResponseMask = this->MyMaskBit(gestaltFXfrMgrPresent) +
- this->MyMaskBit(gestaltFXfrMgrMultiFile) +
- this->MyMaskBit(gestaltFXfrMgrErrorString);
- Gestalt(gestaltFXfrMgrAttr, &aResponse);
- fCommToolBoxAvailable = (aResponseMask & aResponse) == aResponseMask;
-
-
- // Check to see if the terminal manager is present and if relevent attributes are present
-
-
- aResponseMask = this->MyMaskBit(gestaltTermMgrPresent) +
- this->MyMaskBit(gestaltTermMgrErrorString);
- Gestalt(gestaltTermMgrAttr, &aResponse);
- fCommToolBoxAvailable &= (aResponseMask & aResponse) == aResponseMask;
-
-
- // Check to see if the connection manager is present and if relevent attributes are present
-
-
- aResponseMask = this->MyMaskBit(gestaltConnMgrPresent) +
- this->MyMaskBit(gestaltConnMgrCMSearchFix) +
- this->MyMaskBit(gestaltConnMgrErrorString); // this is not being returned as there -> + this->MyMaskBit(gestaltConnMgrMultiAsyncIO);
- Gestalt(gestaltCRMAttr, &aResponse);
- fCommToolBoxAvailable &= (aResponseMask & aResponse) == aResponseMask;
-
-
- // Check to see if the communication resource manager is present and if relevent attributes are present
-
-
- aResponseMask = this->MyMaskBit(gestaltCRMPresent) +
- this->MyMaskBit(gestaltCRMPersistentFix) +
- this->MyMaskBit(gestaltCRMToolRsrcCalls);
- Gestalt(gestaltCRMAttr, &aResponse);
- fCommToolBoxAvailable &= (aResponseMask & aResponse) == aResponseMask;
- }
-
- return fCommToolBoxAvailable;
- }
-
-
- //-------------------------------------------------------------------------
- Boolean CSystemConfiguration::HasThreadManager( void )
- {
- long aResponse = 0;
- long aResponseMask = 0;
-
- if (fGestaltAvailable) {
- aResponseMask = gestaltThreadMgrPresent +
- gestaltSpecificMatchSupport +
- gestaltThreadsLibraryPresent; // Rather then which bit are the flags these are the bits
- Gestalt(gestaltThreadMgrAttr, &aResponse);
- fThreadsAvailable = (aResponseMask & aResponse) == aResponseMask;
- }
-
- return fThreadsAvailable;
-
- }
-
-
- //-------------------------------------------------------------------------
- Boolean CSystemConfiguration::HasAppleEvents( void )
- {
- long aResponse = 0;
- long aResponseMask = 0;
-
- if (fGestaltAvailable) {
-
- aResponseMask = this->MyMaskBit(gestaltAppleEventsPresent);
- Gestalt(gestaltAppleEventsAttr, &aResponse);
- fAppleEventsAvailable = (aResponseMask & aResponse) == aResponseMask;
- }
-
- return fAppleEventsAvailable;
- }
-
-
- //-------------------------------------------------------------------------
- Boolean CSystemConfiguration::HasGestalt( void )
- {
-
- //fGestaltAvailable = TrapAvailable(_Gestalt);
- fGestaltAvailable = true; // seems ok today.
- return fGestaltAvailable;
- }
-
-
- //-------------------------------------------------------------------------
- Boolean CSystemConfiguration::HasSys71orBetter( void )
- {
- long aResponse = 0;
- short aLowword = 0;
- short ahighbyte = 0;
- short alowbyte =0;
-
- if (fGestaltAvailable) {
-
- Gestalt(gestaltSystemVersion, &aResponse);
- aLowword = LoWord(aResponse);
- ahighbyte = aLowword & 0xff00;
- alowbyte = aLowword & 0x00ff;
- if ((ahighbyte >= 7) && (alowbyte >= 1))
- fSystem71orNewer = true;
- else
- fSystem71orNewer = false;
-
- }
-
- return fSystem71orNewer;
- }
-